<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['lang']){
	$_SESSION['show_lang']=$_RQ['lang'];
}
//未登录下单
//$this->model('member')->checklogin();
if($_RQ['op']=='main'){
	//返回链接
	$return['list']=array();
	$return['status']=isset($_RQ['status'])?$_RQ['status']:100;
	set_html('title','参与列表');
	exi($return);
}
// js 获取数据
if($_RQ['op']=='getlist'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']);
	if(isset($_RQ['status']) && $_RQ['status'] !=100){
		$params['status']=intval($_RQ['status']);
		$return['status']=$_RQ['status'];
	}else{
		$return['status']=100;
	}
	if(!empty($_RQ['ordersn'])){
		$params['ordersn']=intval($_RQ['ordersn']);
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_creditchange_order',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	foreach($list as &$item){
		$item['createtime']=date('Y/m/d H:i:s',$item['createtime']);
		$item['statustitle']=$this->order_status[$item['status']];
		$item['goods']=pdo_get('jy_creditchange_goods',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['goodsid']));
	}
	$return['list']=$list;
	exi($return);
}
if($_RQ['op']=='del'){
	$id = intval($_RQ['id']);
	if(!$id){
		exi('订单不存在，请重新选择订单','error');
	}
	pdo_delete('jy_creditchange_order',array('uniacid'=>$_SESSION['uniacid'],'id'=>$id));
	exi('删除订单成功！');
}
if($_RQ['op']=='pay'){
	$id = intval($_RQ['id']);
	if(!$id){
		exi('订单不存在，请重新选择订单','error');
	}
	$order=pdo_get('jy_creditchange_order',array('uniacid'=>$_SESSION['uniacid'],'id'=>$id));
	exi($order['pay_id']);
}
?>